﻿
@{
    ViewData["Title"] = "服务记录";
    Layout = "~/Areas/WX/Views/Shared/_Layout.cshtml";
}

<header class="hui-header">
    <div id="hui-back"></div>
    <h1>服务记录</h1>
</header>

<div class="hui-wrap">

    <form asp-action="PayBills">
        <input type="date" id="str" name="str" class="hui-button hui-button-large hui-date-picker" placeholder="开始日期" style="margin-top:20px;" />
        <input type="date" id="end" name="end" class="hui-button hui-button-large hui-date-picker" placeholder="结束日期" style="margin-top:20px;" />
        <button type="button" id="btnSer" class="hui-button hui-button-large hui-primary" style="margin-top:15px;"><span class="hui-icons hui-icons-search"></span>搜索</button>
    </form>

    <div id="refreshContainer" class="hui-refresh">
        <div class="hui-refresh-icon"></div>
        <div class="hui-refresh-content hui-list" id="con">
            <div id="list"></div>
        </div>
    </div>

</div>


<div class="hui-fooer-line"></div>
<div id="hui-footer">
    <a href="/WX/Home/Index" id="nav-home">
        <div class="hui-footer-icons hui-icons-home"></div>
        <div class="hui-footer-text">首页</div>
    </a>
    <a href="/WX/Home/PayBills" id="nav-news">
        <div class="hui-footer-icons hui-icons-news"></div>
        <div class="hui-footer-text">支付</div>
    </a>
    <div style="width:20%; text-align:center;" class="hui-fl">
        <img src="~/images/jmlogo.jpg" height="44" onclick="hui.back();" />

    </div>
    <a href="/WX/Home/NoticeList" id="nav-forum">
        <div class="hui-footer-icons hui-icons-forum"></div>
        <div class="hui-footer-text">公告</div>
    </a>
    <a href="/WX/Home/PersonalPage" id="nav-my">
        <div class="hui-footer-icons hui-icons-my"></div>
        <div class="hui-footer-text">我的</div>
    </a>
</div>



@section Scripts{
    <script src="~/HUI-master/js/hui-refresh-load-more.js"></script>
    <script>

        var page = 1;
        hui.refresh('#refreshContainer', refresh);
        hui.loadMore(getMore);
        //加载更多
        function getMore() {
            hui.get(
                '/WX/Home/WorkerServiceRecordJson?page=' + page,
                function (res) {
                    var jsonres = JSON.parse(res)
                    var data = jsonres.Data;
                    if (data.length == 0) {
                        hui.endLoadMore(true, '已经到头了...');
                        return false;
                    }
                    for (var i = 0; i < data.length; i++) {
                        var html = '';
                        for (var i = 0; i < data.length; i++) {
                            html += ' <div class="hui-list" style="margin-top:22px;box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);">' +
                                '<a href="#" style="height:auto; height:80px; padding-bottom:8px;">' +
                                ' <div class="hui-list-icons" style="width:110px; height:80px;">' +
                                ' <img src="/images/icon/流水.png" style="width:66px; margin:0px; border-radius:50%;" />' +
                                '</div>' +
                                ' <div class="hui-list-text" style="height:79px; line-height:79px;">' +
                                data[i].orderid +
                                ' <div class="hui-list-info">' +
                                '<span class="hui-icons hui-icons-right"></span>' +
                                ' </div>' +
                                '</div>' +
                                '</a>' +
                                '<a href="#">' +
                                ' <div class="hui-list-text">' +
                                '<div class="hui-list-text-content">' +
                                data[i].service +
                                ' </div>' +
                                '<div class="hui-list-info">' +
                                data[i].dt +
                                '<span class="hui-icons hui-icons-right"></span>' +
                                '</div>' +
                                '</div>' +
                                '  </a>' +
                                '</div>';
                            $('#list').append(html);
                        }
                    }
                    page++;
                    hui.endLoadMore();
                }
            );
        }
        function refresh() {
            hui.loading('加载中...');
            hui.get(
                '/WX/Home/WorkerServiceRecordJson?page=1',
                function (res) {
                    hui.closeLoading();
                    var jsonres = JSON.parse(res)
                    var data = jsonres.Data;
                    if (data.length > 0) {
                        var html = '';
                        for (var i = 0; i < data.length; i++) {
                            html +=
                                ' <div class="hui-list" style="margin-top:22px;box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);">' +
                                '<a href="#" style="height:auto; height:80px; padding-bottom:8px;">' +
                                ' <div class="hui-list-icons" style="width:110px; height:80px;">' +
                                ' <img src="/images/icon/流水.png" style="width:66px; margin:0px; border-radius:50%;" />' +
                                '</div>' +
                                ' <div class="hui-list-text" style="height:79px; line-height:79px;">' +
                                data[i].orderid +
                                ' <div class="hui-list-info">' +
                                '<span class="hui-icons hui-icons-right"></span>' +
                                ' </div>' +
                                '</div>' +
                                '</a>' +
                                '<a href="#">' +
                                ' <div class="hui-list-text">' +
                                '<div class="hui-list-text-content">' +
                                data[i].service +
                                ' </div>' +
                                '<div class="hui-list-info">' +
                                data[i].dt +
                                '<span class="hui-icons hui-icons-right"></span>' +
                                '</div>' +
                                '</div>' +
                                '  </a>' +
                                '</div>';
                        }
                        page = 2;
                        hui('#list').html(html);
                        //结束刷新
                        hui.endRefresh();
                        //重置加载更多状态
                        hui.resetLoadMore();
                    } else {
                        var html = '<div class="hui-common-title" style="margin-top:15px;">' +
                            '<div class="hui-common-title-line" ></div >' +
                            '<div class="hui-common-title-txt">暂无公告</div>' +
                            '<div class="hui-common-title-line"></div>' +
                            '</div>';
                        hui('#con').html(html);
                        //结束刷新
                        hui.endRefresh();
                        //重置加载更多状态
                        //hui.resetLoadMore();
                        hui('#hui-load-more').hide();
                    }


                },
                function () {
                    hui.closeLoading();
                    hui.upToast('连接服务器失败！');
                    hui.endRefresh();
                }
            );
        }

        hui('#btnSer').click(function () {
            var str = hui('#str').val();
            var end = hui('#end').val();
            hui.get(
                '/WX/Home/WorkerServiceRecordJson?str=' + str + '&end=' + end,
                function (res) {
                    hui.closeLoading();
                    var jsonres = JSON.parse(res)
                    var data = jsonres.Data;
                    if (data.length > 0) {
                        var html = '';
                        for (var i = 0; i < data.length; i++) {
                            html +=
                                ' <div class="hui-list" style="margin-top:22px;box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);">' +
                                '<a href="#" style="height:auto; height:80px; padding-bottom:8px;">' +
                                ' <div class="hui-list-icons" style="width:110px; height:80px;">' +
                                ' <img src="/images/icon/流水.png" style="width:66px; margin:0px; border-radius:50%;" />' +
                                '</div>' +
                                ' <div class="hui-list-text" style="height:79px; line-height:79px;">' +
                                data[i].orderid +
                                ' <div class="hui-list-info">' +
                                '<span class="hui-icons hui-icons-right"></span>' +
                                ' </div>' +
                                '</div>' +
                                '</a>' +
                                '<a href="#">' +
                                ' <div class="hui-list-text">' +
                                '<div class="hui-list-text-content">' +
                                data[i].service +
                                ' </div>' +
                                '<div class="hui-list-info">' +
                                data[i].dt +
                                '<span class="hui-icons hui-icons-right"></span>' +
                                '</div>' +
                                '</div>' +
                                '  </a>' +
                                '</div>';
                        }
                        hui('#list').html(html);
                        //结束刷新
                        hui.endRefresh();
                        hui('#hui-load-more').hide();
                    } else {
                        var html = '<div class="hui-common-title" style="margin-top:15px;">' +
                            '<div class="hui-common-title-line" ></div >' +
                            '<div class="hui-common-title-txt">暂无公告</div>' +
                            '<div class="hui-common-title-line"></div>' +
                            '</div>';
                        hui('#con').html(html);
                        //结束刷新
                        hui.endRefresh();
                        //重置加载更多状态
                        //hui.resetLoadMore();
                        hui('#hui-load-more').hide();
                    }
                },
                function (e) {
                    hui.iconToast('读取消息失败', 'warn');
                }
            );
        })

    </script>
}